package top.v5it.japi.plus.data.support.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;

/**
 * 操作日志
 *
 * @author zhanpu
 */
@Data
//@Table(name = "sv_oper_log")
//@Entity
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class OperLog implements Serializable {

    private static final long serialVersionUID = -3439513170232515654L;

    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long sysId;

    /**
     * 日志类型
     */
    @Column(name = "type", length = 20)
    @Enumerated(EnumType.STRING)
    private String type;

    /**
     * 日志标题
     */
    @Column(length = 150)
    private String title;

    /**
     * 请求方法
     */
    @Column(length = 10)
    private String method;

    /**
     * 用户代理
     */
    @Column(name = "user_agent", length = 300)
    private String userAgent;

    /**
     * 请求id
     */
    @Column(name = "request_id", length = 64)
    private String requestId;

    /**
     * 接入来源
     */
    @Column(length = 10)
    private String channel;

    /**
     * 请求url
     */
    @Column(name = "oper_url")
    private String operUrl;

    /**
     * 请求ip
     */
    @Column(name = "oper_ip", length = 50)
    private String operIp;

    /**
     * 请求地址
     */
    @Column(name = "oper_addr")
    private String operAddr;

    /**
     * 请求参数
     */
    @Column(name = "oper_param", length = 2000)
    private String operParam;

    /**
     * 响应状态
     */
    @Column(length = 4)
    private Integer status;

    /**
     * 响应信息
     */
    @Column(length = 200)
    private String message;

    /**
     * 执行时间
     */
    @Column(name = "execute_time")
    private long executeTime;

    /**
     * 处理时间
     */
    @Column(name = "oper_time")
    private Instant operTime;

    /**
     * head authorization
     */
    private String authorization;
}
